package com.zygh.policeasset.controller;

import cn.hutool.core.util.StrUtil;
import com.zygh.policeasset.component.CommonResult;
import com.zygh.policeasset.service.ContractPayMethodService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping({"/contractpaymethod"})
@Api(tags = {"合同预付款模块"})
@RestController
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/controller/ContractPayMethodController.class */
public class ContractPayMethodController {
    @Autowired
    ContractPayMethodService contractPayMethodService;

    @RequestMapping(value = {"/findByProjectAndSectionAndNum"}, method = {RequestMethod.GET})
    @ApiOperation("合同预付款查询")
    public Object findByProjectAndSectionAndNum(@RequestParam String contractPayId, @RequestParam Integer contractPaySection, @RequestParam Integer num) {
        return new CommonResult().success(this.contractPayMethodService.findByProjectAndSectionAndNum(contractPayId, contractPaySection, num));
    }

    @RequestMapping(value = {"/remove"}, method = {RequestMethod.GET})
    @ApiOperation("删除合同付款")
    public Object remove(@RequestParam int id) {
        if (StrUtil.isEmpty(String.valueOf(id))) {
            return new CommonResult().validateFailed("id不能为空");
        }
        if (this.contractPayMethodService.remove(Integer.valueOf(id)) > 0) {
            return new CommonResult().success();
        }
        return new CommonResult().validateFailed("删除错误");
    }
}